package com.zhhd.libdb;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import java.util.List;
@Dao
public interface PatrolRecordDao {
    @Insert
    void insertPatrolRecord(PatrolRecord... patrolRecords);

    @Insert
    void insertPatrolRecords(List<PatrolRecord> patrolRecords);

    @Update
    void updatePatrolRecord(PatrolRecord... patrolRecords);

    /**
     * @return 返回所有数据
     */
    @Query("SELECT * FROM PATROLRECORD")
    List<PatrolRecord> getAllPatrolRecord();

    /**
     * @return 返回未巡更数据
     */
    @Query("SELECT * FROM PATROLRECORD WHERE patrolStatus == 0")
    List<PatrolRecord> loadUnPatrolRecord();

    /**
     * @return 返回已巡更数据
     */
    @Query("SELECT * FROM PATROLRECORD WHERE patrolStatus != 0")
    List<PatrolRecord> loadHasPatrolRecord();
    @Delete
    void deletePatrolRecord(PatrolRecord... patrolRecords);

    @Query("DELETE FROM PATROLRECORD")
    void deleteAllPatrolRecord();
}
